home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / dev / ds3100.md / devFsOpTable.c < prev    next >
C/C++ Source or Header  |  1992-12-18  |  5KB  |  185 lines

  1. /* 
  2.  * devFsOpTable.c --
  3.  *
  4.  *    The operation tables for the file system devices.  
  5.  *
  6.  *    Copyright (C) 1989 Digital Equipment Corporation.
  7.  *    Permission to use, copy, modify, and distribute this software and
  8.  *    its documentation for any purpose and without fee is hereby granted,
  9.  *    provided that the above copyright notice appears in all copies.  
  10.  *    Digital Equipment Corporation makes no representations about the
  11.  *    suitability of this software for any purpose.  It is provided "as is"
  12.  *    without express or implied warranty.
  13.  */
  14.  
  15. #ifndef lint
  16. static char rcsid[] = "$Header: /cdrom/src/kernel/Cvsroot/kernel/dev/ds3100.md/devFsOpTable.c,v 9.8 92/08/13 15:52:38 secor Exp $ SPRITE (Berkeley)";
  17. #endif not lint
  18.  
  19.  
  20. #include "sprite.h"
  21. #include "dev.h"
  22. #include "devInt.h"
  23. #include "fs.h"
  24. #include "rawBlockDev.h"
  25. #include "devFsOpTable.h"
  26. #include "devTypes.h"
  27.  
  28. /*
  29.  * Device specific include files.
  30.  */
  31.  
  32. #include "devSyslog.h"
  33. #include "devNull.h"
  34. #include "devSmem.h"
  35. #include "devSCSIDisk.h"
  36. #include "devSCSITape.h"
  37. #include "devNet.h"
  38. #include "devBlockDevice.h"
  39. #include "scsiHBADevice.h"
  40. #include "raidExt.h"
  41. #include "tty.h"
  42. #include "graphics.h"
  43.  
  44. static ReturnStatus NoDevice();
  45. static ReturnStatus NullProc();
  46.  
  47. #ifdef SERIALB_DEBUG
  48. extern ReturnStatus Dev_serialBOutTrace();
  49. extern ReturnStatus Dev_serialBInTrace();
  50. #endif
  51.  
  52.  
  53. /*
  54.  * Device type specific routine table:
  55.  *    This is for the file-like operations as they apply to devices.
  56.  *    DeviceOpen
  57.  *    DeviceRead
  58.  *    DeviceWrite
  59.  *    DeviceIOControl
  60.  *    DeviceClose
  61.  *    DeviceSelect
  62.  *    DeviceMMap
  63.  */
  64.  
  65. #ifndef lint
  66. DevFsTypeOps devFsOpTable[] = {
  67.     /*
  68.      * Serial lines used to implement terminals.
  69.      */
  70.     {DEV_TERM,       DevTtyOpen, DevTtyRead, DevTtyWrite,
  71.              DevTtyIOControl, DevTtyClose, DevTtySelect,
  72.              DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  73.     /*
  74.      * The system error log.  If this is not open then error messages go
  75.      * to the console.
  76.      */
  77.     {DEV_SYSLOG,    Dev_SyslogOpen, Dev_SyslogRead, Dev_SyslogWrite,
  78.             Dev_SyslogIOControl, Dev_SyslogClose, Dev_SyslogSelect,
  79.             DEV_NO_ATTACH_PROC, Dev_SyslogReopen, NullProc},
  80.     /*
  81.      * SCSI Worm interface.
  82.      */
  83.     {DEV_SCSI_WORM, NoDevice, NullProc, NullProc,
  84.             NullProc, NullProc, NullProc, 
  85.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  86.     /*
  87.      * The following device number is unused.
  88.      */
  89.     {DEV_PLACEHOLDER_2, NoDevice, NullProc, NullProc,
  90.             NullProc, NullProc, NullProc, 
  91.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  92.     /*
  93.      * New SCSI Disk interface.
  94.      */
  95.     {DEV_SCSI_DISK, DevRawBlockDevOpen, DevRawBlockDevRead,
  96.             DevRawBlockDevWrite, DevRawBlockDevIOControl, 
  97.             DevRawBlockDevClose, Dev_NullSelect, DevScsiDiskAttach,
  98.             DevRawBlockDevReopen, NullProc},
  99.     /*
  100.      * SCSI Tape interface.
  101.      */
  102.     {DEV_SCSI_TAPE, DevSCSITapeOpen, DevSCSITapeRead, DevSCSITapeWrite,
  103.             DevSCSITapeIOControl, DevSCSITapeClose, Dev_NullSelect,
  104.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  105.     /*
  106.      * /dev/null
  107.      */
  108.     {DEV_MEMORY,    NullProc, Dev_NullRead, Dev_NullWrite,
  109.             Dev_NullIOControl, NullProc, Dev_NullSelect,
  110.             DEV_NO_ATTACH_PROC, NullProc, NullProc},
  111.     /*
  112.      * Xylogics 450 disk controller.
  113.      */
  114.     {DEV_XYLOGICS, NullProc, Dev_NullRead, 
  115.            Dev_NullWrite, Dev_NullIOControl, 
  116.            NullProc, Dev_NullSelect, 
  117.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  118.     /*
  119.      * Network devices.  The unit number specifies the ethernet protocol number.
  120.      */
  121.     {DEV_NET,      DevNet_FsOpen, DevNet_FsRead, DevNet_FsWrite, 
  122.            DevNet_FsIOControl, DevNet_FsClose, DevNet_FsSelect,
  123.            DEV_NO_ATTACH_PROC, DevNet_FsReopen, NullProc},
  124.     /*
  125.      * Raw SCSI HBA interface.
  126.      */
  127.     {DEV_SCSI_HBA, DevSCSIDeviceOpen, Dev_NullRead, Dev_NullWrite,
  128.                     DevSCSIDeviceIOControl, DevSCSIDeviceClose, Dev_NullSelect,
  129.                     DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  130.     /*
  131.      * RAID device.
  132.      */
  133.     {DEV_RAID, DevRawBlockDevOpen, DevRawBlockDevRead,
  134.                     DevRawBlockDevWrite, DevRawBlockDevIOControl,
  135.                     DevRawBlockDevClose, NullProc, DevRaidAttach,
  136.                     DevRawBlockDevReopen, NullProc},
  137.     /*  
  138.      * Debug device. (useful for debugging RAID device)
  139.      */ 
  140.     {DEV_DEBUG, DevRawBlockDevOpen, DevRawBlockDevRead,
  141.                     DevRawBlockDevWrite, DevRawBlockDevIOControl,
  142.                     DevRawBlockDevClose, NullProc, DevDebugAttach,
  143.                     DevRawBlockDevReopen, NullProc},
  144.     /*
  145.      * The graphics device.
  146.      */
  147.     {DEV_MOUSE, DevGraphicsOpen, DevGraphicsRead, DevGraphicsWrite,
  148.            DevGraphicsIOControl, DevGraphicsClose, DevGraphicsSelect,
  149.            DEV_NO_ATTACH_PROC, NoDevice, NullProc}, 
  150.     /*
  151.      * The following device number is unused.
  152.      */
  153.     {DEV_PLACEHOLDER_3, NoDevice, NullProc, NullProc,
  154.             NullProc, NullProc, NullProc, 
  155.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  156.     /*
  157.      * /dev/smem
  158.      */
  159.     {DEV_SMEM,    NullProc, Dev_SmemRead, Dev_SmemWrite,
  160.             Dev_SmemIOControl, NullProc, Dev_SmemSelect,
  161.             DEV_NO_ATTACH_PROC, NullProc, NullProc},
  162. };
  163.  
  164. static ReturnStatus
  165. NullProc()
  166. {
  167.     return(SUCCESS);
  168. }
  169.  
  170.  
  171. static ReturnStatus
  172. NoDevice()
  173. {
  174.     return(FS_INVALID_ARG);
  175. }
  176.  
  177. #else /*LINT*/
  178.  
  179. DevFsTypeOps devFsOpTable[1];
  180.  
  181. #endif /*LINT*/
  182.  
  183. int devNumDevices = sizeof(devFsOpTable) / sizeof(DevFsTypeOps);
  184.  
  185.